<template>
	<view class="nav" v-for="item,index in money" :key="index">
		<uni-section class="mb-10" :title="item.name" 
		type="line" 
		titleFontSize="16px"
		style="margin-bottom: 3px;" @click="add(item)"> 
			<image src="../../../static/右箭头.png" mode=""
				style="width: 50rpx;height: 50rpx;float: right;margin-top: -38px;margin-right: 10px;"></image>
			<p class="span">查看详情</p>
		</uni-section>
		<view class="line">
			<view class="line1">
				<p>{{item.assets_num}}</p>
				<p>设备总数</p>
			</view>
			<view class="line1">
				<p>{{item.assets_normal}}</p>
				<p>正常设备</p>
			</view>
			<view class="line1">
				<p>{{item.assets_error}}</p>
				<p>故障设备</p>
			</view>
			<view class="line1">
				<p>{{item.errorRate}}</p>
				<p>故障率</p>
			</view>
		</view>
	</view> 
</template>

<script setup>
	import {
		ref,
		reactive
	} from "vue"
	import {
		Assets
	} from "@/utils/file.js"
	let money = reactive([])
	Assets(uni.getStorageSync('token'), 1, 100).then(res => {
		console.log(res, "资产管理");
		money.push(...res.data.data)
		console.log(money, "钱");
	})
	
	function add(item){
		console.log(item);
		uni.navigateTo({
			url:`../Details/Details?id=${item.comp_id}`
		})
	}
</script>

<style scoped lang="scss">
	html,body{
		background-color: #f1f1f1;
	}
	.nav{
		margin-top: 20rpx;
		background-color: white;
	}
	.aps {
		display: inline-block;
	}

	.span {
		display: inline-block;
		float: right;
		margin-right: 35px;
		margin-top: -35px;
	}

	.line {
		width: 96%;
		height: 150rpx;
		// background-color: aqua;
		border-top: 1px solid #cacaca;
		margin: 0 auto;

	}

	.line1 {
		width: 180rpx;
		height: 80%;
		text-align: center;
		// border:1px solid;
		display: inline-block;
		margin-top: 30rpx;
	}

	.line1 p:nth-child(1) {
		// color: #55aaff;
		line-height: 170%;
	}
</style>